{% extends 'AdminBundle::layout.html.twig' %}


{% block title %}注册协议管理{% endblock %}

    {% block css %}
        <link href="{{ asset('umeditor/themes/default/css/umeditor.css') }}" type="text/css" rel="stylesheet">
        <style>
            .edui-container{
                margin-left: 142px;
            }
            #myEditor{
                width: 850px;
                height: 450px;
            }
        </style>
    {% endblock %}


    {% block top %}
        {#{{ dump() }}#}
        {{ parent() }}
    {% endblock %}



    {% block left_body_top %}
        {{ parent() }}
    {% endblock %}

    {% block left_body %}
        {{ parent() }}
    {% endblock %}

    {% block right_body %}
    <div class="page-header">
        <div class="page-right-top">
            <div class="right-top">
                <span class="right-title">系统设置</span>
            </div>
            <div class="top-nav top-nav-active">注册协议管理</div>
        </div>
        <div class="main-content">
            <div class="mes-content">


                <div class="main-mes-content">

                    {#<script type="text/plain" id="myEditor" style="width:850px;height:450px;"></script>#}

                    <script type="text/plain" id="myEditor">{{ data.config_value|raw }}</script>
                    <div class="add-mem-box" style="margin-top: 40px;overflow: hidden;">
                        <div class="com-left fl"></div>
                        <div class="acc-opera-btn fl mem-btn p-first-btn">保存</div>
                        <div class="acc-opera-btn fl mem-cancel">取消</div>
                    </div>
                </div>
            </div>
        </div>
    </div>

{% endblock %}

{% block box %}
{% endblock %}


{% block javascript %}
<script type="text/javascript" src="{{ asset('umeditor/umeditor.config.js') }}"></script>
<script type="text/javascript" src="{{ asset('umeditor/umeditor.min.js') }}"></script>
<script type="text/javascript" src="{{ asset('umeditor/lang/zh-cn/zh-cn.js') }}"></script>
<script type="text/javascript">
    //实例化编辑器
    $(function(){

        SidebarHighlighting('8');

        SonSidebar('8', '6');

        function init(){
            <!-- 实例化编辑器 -->
            var um = UM.getEditor('myEditor');
            bindEvent();

        }

        function bindEvent(){
        }
        init();

        $(".p-first-btn").click(function(){
            var content = $("#myEditor").html();
            console.log(content);

            $.post("{{ path('api_admin_setting_agreement') }}",{content:content},function(data){

                if(data.errorCode == 0){
                    popStatus(1,data.message,1,'',true);
                    location.reload();
                } else {
                    popStatus(2,data.message,1,'',true);
                }
            })
        })
    });
</script>
{% endblock %}
